<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2025/5/4
  Time: 16:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="com.project.DB_Order" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<!DOCTYPE html>
<html>
<head>
    <title>编辑订单</title>
</head>
<body>
<h2>编辑订单</h2>
<%
    String oid = request.getParameter("oid");
    if (oid != null) {
        DB_Order dbOrder = new DB_Order();
        List<String> findInput = new ArrayList<>();
        List<String> returnList = new ArrayList<>();
        findInput.add(oid);
        dbOrder.find("oid", oid, returnList);

        if (!returnList.isEmpty()) {
            String uid = returnList.get(1);
            String aid = returnList.get(2);
            String payamount = returnList.get(4);
            String state = returnList.get(5);
%>
<form action="updateOrder.jsp" method="post">
    <input type="hidden" name="oid" value="<%= oid %>">
    <label for="uid">用户ID:</label>
    <input type="text" id="uid" name="uid" value="<%= uid %>" required><br>
    <label for="aid">航线ID:</label>
    <input type="text" id="aid" name="aid" value="<%= aid %>" required><br>
    <label for="payamount">支付金额:</label>
    <input type="text" id="payamount" name="payamount" value="<%= payamount %>" required><br>
    <label for="state">订单状态:</label>
    <input type="text" id="state" name="state" value="<%= state %>" required><br>
    <input type="submit" value="更新订单">
</form>
<%
        } else {
            out.println("未找到要编辑的订单");
        }
    } else {
        out.println("未获取到订单ID");
    }
%>
</body>
</html>